/**
 * Created by user on 2018/3/20.
 */
import { MainActionType } from '../actions/mainAction'
const main_state = {
  screen: -1,
  info: {},
  showReConnect: false,
  showQuitPc: false,
  materials: [],
  showWait: false,
  teachers: [],
  bigImage: '',
  globalToken: ''
}
const MainScreenState = (state = main_state, action) => {
  switch (action.type) {
    case MainActionType.set_global_token:
      return Object.assign({}, state, {
        globalToken: action.payload.token
      })
    case MainActionType.toggle_global_image:
      return Object.assign({}, state, {
        bigImage: action.payload.url
      })
    case MainActionType.set_teachers:
      return Object.assign({}, state, {
        teachers: action.teachers
      })
    case MainActionType.toggle_show_wait:
      return Object.assign({}, state, {
        showWait: action.showWait
      })
    case MainActionType.change_screen:
      return Object.assign({}, state, {
        screen: action.screen
      })
    case MainActionType.set_materials:
      return Object.assign({}, state, {
        materials: action.materials
      })
    case MainActionType.set_info:
      return Object.assign({}, state, {
        info: action.info
      })
    case MainActionType.toggle_re_connect:
      return Object.assign({}, state, {
        showReConnect: action.connect
      })
    case MainActionType.toggle_quit_pc:
      return Object.assign({}, state, {
        showQuitPc: action.quit
      })
    default:
      return state
  }
}
MainScreenState._default_state = main_state
export default MainScreenState
